<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="s" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>客户对账报表</title>
    <jsp:include page="../../head.jsp"/>
    <script type="text/javascript" src="<s:url value="js/ajaxutil.js"/>"></script>
</head>
<script type="text/javascript">
    var bstate = "${param.declaraState }";
    var comId = "${sessionScope.CURRENT_USER.company.id}";
    var businessType = [["已下单，待审核", "DS01"], ["平台审核通过", "DS02"],
        ["已安排", "DS04"], ["已安排", "DS04"], ["初审", "DS06"],
        ["复审", "DS07"], ["现场递单", "DS08"], ["海关查货", "DS09"],
        ["海关放行", "DS10"], ["商检放行", "DS11"], ["已完成", "DS05"]];
    var formSetting = {
        title: "查询报关报检业务信息",
        module: 'query',
        columns: [{
            name: "businessId",
            label: "业务编码"
        }, {
            name: "creator",
            label: "下单操作人"
        }, {
            name: "container_no",
            label: "集装箱号"
        }, {
            name: "company_name",
            label: "经营单位"
        }, {
            name: "CONFIRM_TIME",
            label: "业务提交时间从",
            type: "date",
            op: "ge"
        }, {
            name: "CONFIRM_TIME",
            label: "到",
            type: "date",
            op: "le"
        }, {
            name: "shipper.company",
            label: "实际委托人"
        }, {
            name: "supCompany.name",
            label: "业务供应商"
        }, {
            name: "state",
            label: "业务状态",
            type: "dropdown",
            data: businessType
        }],
        buttons: {
            custom: []
        },
        grid: {
            id: "declarationsDataGrid",
            title: "查询结果",
            url: "declaration-platFormDeclarationReporFindtList",
            /* postData : {
             "pid" : pid
             }, */
            postData: {
                "declaraState": bstate
            },
            colModel: [{
                index: "ID",
                name: "id",
                hidden: true
            }, {
                index: "confirmTime",
                name: "confirmTime",
                label: "业务提交时间",
                formatter: 'date',
                formatoptions: {
                    srcformat: 'Y-m-d H:i:s',
                    newformat: 'Y-m-d H:i:s'
                }
            }, {
                index: "businessId",
                name: "businessId",
                label: "业务编号"
            }, {
                index: "shipper",
                name: "shipper.company",
                label: "实际委托人"
            }, {
                index: "company_name",
                name: "company_name",
                label: "经营单位"
            }, {
                index: "container_no",
                name: "container_no",
                label: "集装箱号"
            }, {
                index: "sno",
                name: "sno",
                label: "报关单号"
            }, {
                index: "supNAME",
                name: "supCompany.name",
                label: "业务供应商"
            }, {
                index: "declaration_port",
                name: "declaration_port",
                label: "申报口岸"
            }, {
                index: "state",
                name: "state",
                data: [["审核通过", "平台审核通过"], ["已申报", "已受理"], ["已完成", "DS05"], ["已申报", "初审"],
                    ["已申报", "复审"], ["已申报", "现场递单"], ["查验", "海关查验"],
                    ["海关放行", "DS10"], ["商检放行", "DS11"]],
                label: "状态"
            }, {
                index: "declaration_free",
                name: "declaration_free",
                label: "费用"
            }, {
                index: "pay_id",
                name: "pay_id",
                label: "支付编号"
            }, {
                name: "bpk",
                label: "bpk",
                hidden: true
            }],
            sortname: "businessId",
            sortorder: "desc",
            jsonReader: {
//                root: "declarations"
            },
            loadComplete: function (data) {
                $("td[aria-describedby='declarationsDataGrid_state']").each(function () {
                    if ($(this).text() == "平台审核通过") {
                        $(this).text("审核通过");
                    } else if ($(this).text() == "已受理" || $(this).text() == "初审"
                               || $(this).text() == "复审" || $(this).text() == "现场递单") {
                        $(this).text("已申报");
                    } else if ($(this).text() == "海关查验") {
                        $(this).text("查验");
                    }
                });
            }
        }
    };
    $(document).ready(function () {
        $("#declarationsDataTable").mrdForm(formSetting);
    });

    function setGridCell(i, name, value) {
        var ids = $("#declarationsDataGrid").getDataIDs();
        $("#declarationsDataGrid").setCell(ids[i], name, value);
    }
</script>
<body>
<div id="declarationsDataTable"></div>
<input id="companyId" type="hidden" value="${companyId }"/>
<!-- 	<a id="download_img" href="javascript:void(0)"></a> -->
</body>
</html>
